const {
  WORK_ORDER_STATUS,
  ABNORMAL_STATUS,
  WORK_ORDER_CREATE_MODE
} = require('../../../constant/index')
const {
  getEventData
} = getApp()
Component({
  properties: {
    data: Object
  },

  data: {
    ABNORMAL_STATUS,
    WORK_ORDER_STATUS,
    WORK_ORDER_CREATE_MODE
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onClick() {
      this.triggerEvent('click')
    },

    onShowWarningInfo(event) {
      const {
        status
      } = getEventData(event)
      wx.showModal({
        content: this.getTitle(status),
        showCancel: false,
        success: (res) => {}
      })
    },

    getTitle(status) {
      let title;
      switch (status) {
        case ABNORMAL_STATUS.normal:
          title = '正常工单'
          break;
        case ABNORMAL_STATUS.unassignedouttime:
          title = '分单超时'
          break;
        case ABNORMAL_STATUS.responseouttime:
          title = '响应超时'
          break;
        case ABNORMAL_STATUS.appointmentouttime:
          title = '预约超时'
          break;
        case ABNORMAL_STATUS.signouttime:
          title = '签到超时'
          break;
        case ABNORMAL_STATUS.repairouttime:
          title = '维修超时'
          break;
      }

      return title
    }
  }
})